package cn.nexd.utils;

import android.app.Activity;
import android.content.Context;
import android.os.Build;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.util.DisplayMetrics;

import java.util.UUID;

import cn.nexd.utils.framework.tools.Logger;
import cn.nexd.utils.framework.tools.PhoneUtil;

/**
 * Created by wangxu on 16/12/14.
 */

public class CellPhonePresenter {


    private static final String TAG = "CellPhonePresenter";
    private Context context;

    private IPhoneActivityView iPhoneActivityView;


    public CellPhonePresenter(Context context, IPhoneActivityView iPhoneActivityView) {
        this.context = context;
        this.iPhoneActivityView = iPhoneActivityView;
    }

    public void getCellPhoneMsg() {
        String androidVersion = PhoneUtil.getInstance(this.context).getAndroidVersion();

        String apiLevel = PhoneUtil.getInstance(this.context).getAPILevel();

        String deviceId = PhoneUtil.getInstance(this.context).getDeviceId();

        String softVersion = PhoneUtil.getInstance(this.context).getDeviceSoftwareVersion();

        String phoneModel = PhoneUtil.getInstance(this.context).getPhoneModel();

        TelephonyManager var1 = (TelephonyManager) this.context.getSystemService(Context.TELEPHONY_SERVICE);
        String var2 = "" + var1.getDeviceId();
        String var3 = "" + var1.getSimSerialNumber();
        String var4 = "" + Settings.Secure.getString(this.context.getContentResolver(), "android_id");
        UUID var5 = new UUID((long) var4.hashCode(), (long) var2.hashCode() << 32 | (long) var3.hashCode());
        String var6 = var5.toString();
        DisplayMetrics var = new DisplayMetrics();
        Activity var7 = (Activity) this.context;
        var7.getWindowManager().getDefaultDisplay().getMetrics(var);
        String var8 = var.widthPixels + " * " + var.heightPixels;

        Logger.debug(TAG, "getCellPhoneMsg: " + var2 + "\n" + var3 + "\n" + var4 + "\n" + var5 + "\n" + var6 + "\n" + var7 + "\n" + var8 + "\n");


        iPhoneActivityView.setPhoneMsg("androidVersion = " + androidVersion + "\n" +
                "apiLevel = " + apiLevel + "\n" +
                "deviceId = " + deviceId + "\n" +
                "softVersion = " + softVersion + "\n" +
                "phoneModel = " + phoneModel + "\n" +
                "model = " + Build.MODEL);
    }
}
